package com.zhangkunhao.notes.pool;

import java.sql.Connection;


/**
 * 连接的包装类
 *
 * @author 20642
 */
public class PooledConnection {
    /**
     * 连接的状态：默认可用
     */
    private boolean busy = false;
    /**
     * 真正的sql连接connection
     */
    private Connection connection;
    /**
     * 只是用来测试当前connectionName,便于观察
     */
    private String connectionName;

    public PooledConnection() {
    }

    public PooledConnection(boolean busy, Connection connection, String connectionName) {
        this.busy = busy;
        this.connection = connection;
        this.connectionName = connectionName;
    }


    @Override
    public String toString() {
        return "PooledConnection{busy = " + busy + ", con = " + connection + ", connName = " + connectionName + "}";
    }

    /**
     * 获取
     *
     * @return busy
     */
    public boolean isBusy() {
        return busy;
    }

    /**
     * 设置
     *
     * @param busy：
     */
    public void setBusy(boolean busy) {
        this.busy = busy;
    }

    /**
     * 获取
     *
     * @return con
     */
    public Connection getConnection() {
        return connection;
    }

}
